<template>
    <div id="hospital" class="hospital">
        <el-button @click="insertList" class="slot-btn-top" type="primary" size="small">添加申请</el-button>
        <el-table :data="listdata.slice((currentPage-1)*pagesize,currentPage*pagesize)" stripe border :height="tableHeight" :header-cell-style="getRowClass">
            <el-table-column prop="applyDealerName" label="经销商名称" sortable min-width="280"></el-table-column>
            <el-table-column prop="applyHospitalName" label="报单医院" sortable min-width="280"></el-table-column>
            <el-table-column prop="applyOfficeName" label="报单科室" sortable min-width="120"></el-table-column>
            <el-table-column prop="applyDealerUserName" label="报单人" sortable min-width="90"></el-table-column>
            <el-table-column prop="applyTime" label="申请日期" :formatter="formatApplyTime" sortable min-width="170"></el-table-column>
            <el-table-column prop="applyStatusDesc" label="申请状态" sortable min-width="110"></el-table-column>
            <el-table-column fixed="right" label="操作" align="center" min-width="100">
                <template slot-scope="scope">
                    <el-button v-if="scope.row.applyStatus==0" @click="deleteList(scope.row.id)" type="text" size="small">撤销</el-button>
                    <el-button @click="updateList(scope.row)" type="text" size="small">详情</el-button>
                </template>
            </el-table-column>
        </el-table>
        <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[5,10, 15,20, 25,30,50, 100]" :page-size="pagesize" layout="total, sizes, prev, pager, next, jumper" :total="listdata.length"></el-pagination>

        <!-- 新增窗口 -->
        <el-dialog :title="dialogTitle" width="75%" top="50px" :visible.sync="isDialog" :close-on-click-modal="false">
            <el-button type="primary"  @click="selectDealerManager" >经销商管理人员信息</el-button>
            <el-form :inline="true" class="demo-form-inline" v-model="restaurants" label-position="right" label-width="120px">
                <el-form-item label="医院名称"><el-select @change="changeHospitalName" v-model="restaurants.applyHospitalId" filterable allow-create default-first-option placeholder="请输入医院名称"><el-option v-for="item in hospital" :key="item.id" :label="item.hospitalName" :value="item.id"></el-option></el-select></el-form-item>
                <el-form-item label="医院类别"><el-select v-model="restaurants.hospitalType"><el-option v-for="item in hospitalCategory" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
                <el-form-item label="医院级别"><el-select v-model="restaurants.hospitalLevel"><el-option v-for="item in hospitalLevel" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
                <el-form-item label="医院科室"><el-select v-model="restaurants.applyOffice"><el-option v-for="item in office" :key="item.code" :label="item.name" :value="item.code"></el-option></el-select></el-form-item>
            </el-form>
            <el-form :inline="true" class="demo-form-inline" label-position="right" label-width="120px" v-model="restaurants">
                <el-form-item label="医院地址">
                    <div style="width: 610px;">
                        <el-select v-model="sheng1" @change="choseSheng(sheng1,1)" placeholder="省级地区"><el-option v-for="item in shengs" :key="item.value" :label="item.value" :value="item.value"></el-option></el-select>
                        <el-select v-model="shi1" @change="choseCity(shi1,1)" placeholder="市级地区"><el-option v-for="item in shis" :key="item.value" :label="item.value" :value="item.value"></el-option></el-select>
                        <el-select v-model="qu1" @change="choseBlock(qu1,1)" placeholder="区级地区"><el-option v-for="item in qus" :key="item.value" :label="item.value" :value="item.value"></el-option></el-select>
                        <el-input v-model="restaurants.addressDetail" style="margin-top: 5px;" type="textarea" :rows="2" placeholder="请输入详细地址"></el-input>
                    </div>
                </el-form-item>
            </el-form>
            <el-form label-position="right" label-width="120px" :model="restaurants">
                <el-form-item label="申请缘由"><el-input v-model="restaurants.applyReason" type="textarea" :rows="2" style="width:98%"></el-input></el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer" style="text-align: center;">
                <el-button @click="queryApplyFormStatus" type="primary">确 定</el-button>
            </div>
        </el-dialog>


        <!-- 详情 -->
        <el-dialog :title="updateTitle" width="800px" top="50px" :visible.sync="isUpdate" :close-on-click-modal="false">

            <el-button type="primary"  @click="selectDealerManager" >经销商管理人员信息</el-button>
            <el-form :inline="true" class="demo-form-inline" v-model="tableData" label-position="right" label-width="100px">
                <el-form-item label="医院名称"><el-input v-model="tableData.applyHospitalName" disabled></el-input></el-form-item>
                <el-form-item label="医院类别"><el-input v-model="tableData.applyHospitalTypeDesc" disabled></el-input></el-form-item>
                <el-form-item label="医院级别"><el-input v-model="tableData.applyHospitalLevelDesc" disabled></el-input></el-form-item>
                <el-form-item label="医院科室"><el-input v-model="tableData.applyOfficeName" disabled></el-input></el-form-item>
            </el-form>


            <el-form :inline="true" class="demapplyAddressDetailo-form-inline" v-model="tableData" label-position="right" label-width="100px">
                <el-form-item label="医院地址">
                    <div style="width: 610px;">
                        <el-input v-model="tableData.applyAddressSheng" disabled style="width: 200px;"></el-input>
                        <el-input v-model="tableData.applyAddressShi" disabled style="width: 200px;"></el-input>
                        <el-input v-model="tableData.applyAddressQuxian" disabled style="width: 200px;"></el-input>
                        <el-input v-model="tableData.applyAddressDetail" disabled style="margin-top: 5px;" type="textarea" :rows="2" placeholder="请输入详细地址"></el-input>
                    </div>
                </el-form-item>
            </el-form>


            <el-form :inline="true" class="demapplyAddressDetailo-form-inline" v-model="tableData" label-position="right" label-width="100px">
                <el-form-item label="申请经销商"><el-input v-model="tableData.applyDealerName" disabled></el-input></el-form-item>
                <el-form-item label="申请人"><el-input v-model="tableData.applyDealerUserName" disabled></el-input></el-form-item>
                <el-form-item label="申请时间"><el-input v-model="tableData.applyTime" disabled></el-input></el-form-item>
            </el-form>
            <el-form  label-position="right" label-width="100px" :model="tableData">
                <el-form-item label="申请缘由"><el-input  v-model="tableData.applyReason" disabled type="textarea" :rows="2" style="width:98%"></el-input></el-form-item></el-form>


            <h3 class="dialog-plate-title" style="margin-bottom: 20px"><span>审核结果</span></h3>
            <el-form :inline="true" class="demo-form-inline" v-model="tableData" label-position="right" label-width="100px">
                <el-form-item label="申请状态"><el-input v-model="tableData.applyStatusDesc" disabled></el-input></el-form-item>
                <el-form-item label="审核人"><el-input v-model="tableData.auditUserName" disabled></el-input></el-form-item>
                <el-form-item label="审核时间"><el-input v-model="tableData.auditTime" disabled></el-input></el-form-item>
                <el-form-item label="审核批注"><el-input type="textarea" :rows="2" placeholder="这里是审核批注" v-model="tableData.auditDetail" style="width:500px" disabled></el-input></el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer" style="text-align: right;"><el-button @click="isUpdate=false" type="primary">关 闭</el-button></div>
        </el-dialog>


        <!-- 提示信息 -->
        <el-dialog title="提示信息" :visible.sync="dialogVisible" center width="30%" >
            <span v-html="Promptinformation"></span>
            <span slot="footer" class="dialog-footer">
                <el-button @click="submitList">继续报单</el-button>
                <el-button type="primary" @click="dialogVisible = false">取消报单</el-button>
            </span>
        </el-dialog>
        <el-dialog title="厂商的经销商管理人员信息" center :visible.sync="glyxx" width="350px">
            <span >管理人员名称：{{adminformationName}}</span> <br>
            <span >管理人员电话：{{adminformationPhone}}</span>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="glyxx = false">关闭</el-button>
            </div>
        </el-dialog>

    </div>
</template>


<script>
    export default {
        data() {
            return {
                // 三级联动
                addressData: {},
                shengs: "",
                shis: [],
                qus: [],
                city: "",
                block: "",


                glyxx:false,
                adminformationName:'',
                adminformationPhone:'',

                dialogVisible: false,
                tokenId: sessionStorage.getItem("tokenId"),
                tableHeight: document.documentElement.clientHeight - 160,
                currentPage: 1,
                pagesize: 10,


                listdata: [],
                isDialog: false,
                isUpdate: false,
                dialogTitle: "",
                updateTitle: "",
                jxsglry: false,
                hospital: [],
                state1: "",
                Promptinformation: "",
                hospitalCategory: [],
                hospitalLevel: [],
                dialogCompetitorList: {
                    hospitalCategory: "",
                    hospitalLevel: ""
                },

                restaurants: {
                    applyAddressDetail: '',
                    applyAddressQuxian: '',
                    applyAddressSheng: '',
                    applyAddressShi: '',
                    applyDealerId: '',
                    applyDealerName: '',
                    applyDealerUserId: '',
                    applyDealerUserName: '',
                    applyHospitalId: '',
                    applyHospitalLevel: '',
                    applyHospitalLevelDesc: '',
                    applyHospitalName: '',
                    applyHospitalType: '',
                    applyHospitalTypeDesc: '',
                    applyOffice: '',
                    applyOfficeName: '',
                    applyReason: '',
                    applyStatus: '',
                    applyStatusDesc: '',
                    applyTime: '',
                    auditDetail: '',
                    auditTime: '',
                    auditUserId: '',
                    auditUserName: '',
                    earlyWarning: '',
                    id: '',
                    revokeReason: '',
                    revokeTime: '',
                    revokeUserId: '',
                    revokeUserName: '',
                },

                sheng1: "",
                shi1: "",
                qu1: "",

                applyStatus: "",
                office: [],
                nullQueryLikeName: true,
                tableData: {
                    applyHospitalId: "",
                    applyHospitalName: "",
                    applyHospitalType: "",
                    applyHospitalTypeDesc: "",
                    applyHospitalLevel: "",
                    applyHospitalLevelDesc: "",
                    applyAddressSheng: "",
                    applyAddressShi: "",
                    applyAddressQuxian: "",
                    applyAddressDetail: "",
                    applyOffice: "",
                    applyOfficeName: "",
                    applyDealerId: "",
                    applyDealerName: "",
                    applyDealerUserId: "",
                    applyDealerUserName: "",
                    applyTime: "",
                    applyReason: "",
                    applyStatus: "",
                    auditUserId: "",
                    auditUserName: "",
                    auditTime: "",
                    auditDetail: "",
                    revokeUserId: "",
                    revokeUserName: "",
                    revokeTime: "",
                    revokeReason: ""
                }
            };
        },
        created() {
            this.queryApplyByLoginer();
            this.getAllCityData();
            this.queryAllHospitalBaseList();
            this.getHospitalCategoryData();
            this.getHospitalLevelData();
            this.hospital_office();
        },
        methods: {
            getAllCityData() {
                let _this = this;
                this.$http.get(".././../static/json/map.json").then(function (response) {
                    if (response.status == 200) {
                        let data = response.data;
                        _this.addressData = response.data;
                        _this.shengs = [];
                        _this.city = [];
                        _this.block = [];
                        // 省市区数据分类
                        for (let item in data) {
                            if (item.match(/0000$/)) {
                                //省
                                _this.shengs.push({
                                    id: item,
                                    value: data[item],
                                    children: []
                                });
                            } else if (item.match(/00$/)) {
                                //市
                                _this.city.push({id: item, value: data[item], children: []});
                            } else {
                                //区
                                _this.block.push({id: item, value: data[item]});
                            }
                        }
                        // 分类市级
                        for (let index in _this.shengs) {
                            for (let index1 in _this.city) {
                                if (
                                    _this.shengs[index].id.slice(0, 2) ===
                                    _this.city[index1].id.slice(0, 2)
                                ) {
                                    _this.shengs[index].children.push(_this.city[index1]);
                                }
                            }
                        }
                        // 分类区级
                        for (let item1 in _this.city) {
                            for (let item2 in _this.block) {
                                if (
                                    _this.block[item2].id.slice(0, 4) ===
                                    _this.city[item1].id.slice(0, 4)
                                ) {
                                    _this.city[item1].children.push(_this.block[item2]);
                                }
                            }
                        }
                    } else {
                        console.log(response.status);
                    }
                }).catch(function (error) {console.log(typeof +error);});
            },
            getHospitalCategoryData() {
                let _this = this;
                this.$http({
                    url: "/api/adscm/dealer/jyHospitalBase/getHospitalTypeLevel/1?tokenId=" + _this.tokenId,
                    method: "post",
                    headers: {"X-Requested-With": "XMLHttpRequest"}
                }).then(function (res) {
                    console.log(res.data);
                    if (res.data.statusCode == 200) {
                        _this.hospitalCategory = res.data.content;
                    } else {
                        _this.$message.error(res.data.desc);
                    }
                }).catch(function (catchres) {
                    _this.$message.error("加载失败！请重新加载...");
                });
            },
            getHospitalLevelData() {
                let _this = this;
                this.$http({
                    url: "/api/adscm/dealer/jyHospitalBase/getHospitalTypeLevel/2?tokenId=" + _this.tokenId,
                    method: "post",
                    headers: {"X-Requested-With": "XMLHttpRequest"}
                }).then(function (res) {
                    console.log(res.data);
                    if (res.data.statusCode == 200) {
                        _this.hospitalLevel = res.data.content;
                    } else {
                        _this.$message.error(res.data.desc);
                    }
                }).catch(function (catchres) {
                    _this.$message.error("加载失败！请重新加载...");
                });
            },
            //查询当前登录用户的报单申请列表
            queryApplyByLoginer() {
                let _this = this;
                this.$http({
                    url: "/api/adscm/dealer/jyDeclarationForm/queryApplyByLoginer/3?tokenId=" + _this.tokenId,
                    method: "post",
                    headers: {"X-Requested-With": "XMLHttpRequest"}
                }).then(function (res) {
                    console.log( res.data )
                    if (res.data.statusCode == 200) {
                        _this.listdata = res.data.content;
                        console.log(_this.listdata);
                    } else {
                        _this.$message.error(res.data.desc);
                    }
                }).catch(function (catchres) {
                    _this.$message.error("加载失败！请重新加载...");
                });
            },
            // 查询医院名称
            queryAllHospitalBaseList() {
                let _this = this;
                this.$http({
                    url: "/api/adscm/dealer/jyHospitalBase/queryAllHospitalList?tokenId=" + _this.tokenId,
                    method: "post",
                    headers: {"X-Requested-With": "XMLHttpRequest"}
                }).then(function (res) {
                    console.log( res.data )

                    if (res.data.statusCode == 200) {
                        _this.hospital = res.data.content;
                    } else {
                        _this.$message.error(res.data.desc);
                    }
                }).catch(function (catchres) {
                    _this.$message.error("加载失败！请重新加载...");
                });
            },
            // 查询医院科室
            hospital_office() {
                let _this = this;
                this.$http({
                    url: "/api/adscm/system/code/queryCoedByType/hospital_office?tokenId=" + _this.tokenId,
                    method: "post",
                    headers: {"X-Requested-With": "XMLHttpRequest"}
                }).then(function (res) {
                    if (res.data.statusCode == 200) {
                        _this.office = res.data.content;
                        console.log(_this.listdata);
                    } else {
                        _this.$message.error(res.data.desc);
                    }
                }).catch(function (catchres) {
                    _this.$message.error("加载失败！请重新加载...");
                });
            },
            queryLikeName(name) {
                let _this = this;
                this.$http({
                    url: "/api/adscm/dealer/jyHospitalBase/queryHospitalBase/" + name + "?tokenId=" + _this.tokenId,
                    method: "post",
                    headers: {"X-Requested-With": "XMLHttpRequest"}
                }).then(function (res) {
                    if (res.data.statusCode == 200) {
                        _this.restaurants.hospitalLevel = res.data.content.hospitalLevel+'';
                        _this.restaurants.hospitalType = res.data.content.hospitalType+'';
                        _this.restaurants.applyHospitalId = res.data.content.id;
                        _this.restaurants.addressDetail =res.data.content.addressDetail;
                        _this.sheng1 = res.data.content.addressSheng;
                        _this.shi1 = res.data.content.addressShi;
                        _this.qu1 = res.data.content.addressQuxian;
                    } else {
                        _this.$message.error(res.data.desc);
                    }
                }).catch(function (catchres) {
                    _this.$message.error("加载失败！请重新加载...");
                });
            },
            // 查询详情
            queryDealerApplyFormDetail(id) {
                let _this = this;
                this.$http({
                    url: "/api/adscm/dealer/jyDeclarationForm/queryDealerApplyFormDetail/" + id + "?tokenId=" + _this.tokenId,
                    method: "post",
                    headers: {"X-Requested-With": "XMLHttpRequest"}
                }).then(function (res) {
                    if (res.data.statusCode == 200) {
                        _this.tableData = res.data.content;
                        _this.tableData.applyTime = _this.timestampToTime(  _this.tableData.applyTime );
                        _this.tableData.auditTime = _this.timestampToTime(  _this.tableData.auditTime );
                    } else {
                        _this.$message.error(res.data.desc);
                    }
                }).catch(function (catchres) {
                    _this.$message.error("加载失败！请重新加载...");
                });
            },

            // 查询该医院是否已经有报单的供应商了
            queryApplyFormStatus() {
                let _this = this;
                let data = {
                    id: _this.restaurants.id,
                    applyHospitalName: typeof _this.restaurants.applyHospitalId == 'number' ? '' : _this.restaurants.applyHospitalId,
                    applyHospitalId: typeof _this.restaurants.applyHospitalId == 'number' ?  _this.restaurants.applyHospitalId : '',
                    applyHospitalType: _this.restaurants.hospitalType,
                    applyHospitalLevel: _this.restaurants.hospitalLevel,
                    applyOffice: _this.restaurants.applyOffice,
                    applyAddressSheng: _this.sheng1,
                    applyAddressShi: _this.shi1,
                    applyAddressQuxian: _this.qu1,
                    applyAddressDetail: _this.restaurants.addressDetail,
                    applyReason: _this.restaurants.applyReason,
                };


                console.log( data )

                this.$http({
                    url: "/api/adscm/dealer/jyDeclarationForm/queryApplyFormStatus?tokenId=" + _this.tokenId,
                    method: "post",
                    headers: {"X-Requested-With": "XMLHttpRequest"},
                    data: data
                }).then(function (res) {
                    if (res.data.statusCode == 200) {
                        _this.submitList();
                    } else if (res.data.statusCode == 300) {
                        _this.dialogVisible = true;
                        _this.Promptinformation = res.data.desc;
                        _this.applyStatus = res.data.content
                    } else {
                        _this.$message.error(res.data.desc);
                    }
                }).catch(function (catchres) {
                    _this.$message.error("加载失败！请重新加载...");
                });
            },
            changeHospitalName() {
                if (typeof this.restaurants.applyHospitalId == "number") {

                    console.log( this.restaurants.applyHospitalId )

                    this.queryLikeName(this.restaurants.applyHospitalId);
                } else {
                    this.nullQueryLikeName = false;
                    this.sheng1 = "";
                    this.shi1 = "";
                    this.qu1 = "";
                    this.restaurants = {
                        applyAddressDetail: '',
                        applyAddressQuxian: '',
                        applyAddressSheng: '',
                        applyAddressShi: '',
                        applyDealerId: '',
                        applyDealerName: '',
                        applyDealerUserId: '',
                        applyDealerUserName: '',
                        applyHospitalId: this.restaurants.applyHospitalId,
                        applyHospitalLevel: '',
                        applyHospitalLevelDesc: '',
                        applyHospitalName: '',
                        applyHospitalType: '',
                        applyHospitalTypeDesc: '',
                        applyOffice: '',
                        applyOfficeName: '',
                        applyReason: '',
                        applyStatus: '',
                        applyStatusDesc: '',
                        applyTime: '',
                        auditDetail: '',
                        auditTime: '',
                        auditUserId: '',
                        auditUserName: '',
                        earlyWarning: '',
                        id: '',
                        revokeReason: '',
                        revokeTime: '',
                        revokeUserId: '',
                        revokeUserName: '',
                    };
                }
            },
            deleteList(row) {
                let _this = this;
                this.$confirm('是否撤销申请?', '提示', {
                    confirmButtonClass: 'el-button--warning'
                }).then(() => {
                    _this.$http({
                        url: "/api/adscm/dealer/jyDeclarationForm/revokeDealerApply/"+row+"?tokenId=" + _this.tokenId,
                        method: "post",
                        headers: { "X-Requested-With": "XMLHttpRequest" }
                    }).then(function(res) {
                        if (res.data.statusCode == 200) {
                            _this.$message({
                                message: '撤销成功',
                                type: 'success'
                            });
                            _this.queryApplyByLoginer();
                        } else {_this.$message.error(res.data.desc);}
                    }).catch(function(catchres) {_this.$message.error("加载失败！请重新加载...");});
                }).catch(() => {});

            },
            updateList(row) {
                this.isUpdate = true;
                this.updateTitle = "报单详情";
                this.queryDealerApplyFormDetail(row.id);
                this.tableData = row;
            },
            insertList() {
                this.isDialog = true;
                this.dialogTitle = "申请报单";
                this.restaurants={
                    applyAddressDetail: '',
                        applyAddressQuxian: '',
                        applyAddressSheng: '',
                        applyAddressShi: '',
                        applyDealerId: '',
                        applyDealerName: '',
                        applyDealerUserId: '',
                        applyDealerUserName: '',
                        applyHospitalId: '',
                        applyHospitalLevel: '',
                        applyHospitalLevelDesc: '',
                        applyHospitalName: '',
                        applyHospitalType: '',
                        applyHospitalTypeDesc: '',
                        applyOffice: '',
                        applyOfficeName: '',
                        applyReason: '',
                        applyStatus: '',
                        applyStatusDesc: '',
                        applyTime: '',
                        auditDetail: '',
                        auditTime: '',
                        auditUserId: '',
                        auditUserName: '',
                        earlyWarning: '',
                        id: '',
                        revokeReason: '',
                        revokeTime: '',
                        revokeUserId: '',
                        revokeUserName: '',
                };
            },
            submitList() {
                let _this = this;
                let url;
                if (this.dialogTitle === "申请报单") {
                    url = "/api/adscm/dealer/jyDeclarationForm/addDeclarationForm?tokenId=" + _this.tokenId;
                }
                let hosName;
                if (typeof _this.restaurants.applyHospitalId == 'number'){
                    for (let i= 0;i<_this.hospital.length;i++) {
                        if (_this.restaurants.applyHospitalId == _this.hospital[i].id) {
                            hosName = _this.hospital[i].hospitalName;
                        }
                    }
                }
                let data = {
                    id: _this.restaurants.id,
                    applyHospitalName: typeof _this.restaurants.applyHospitalId == 'number' ? hosName : _this.restaurants.applyHospitalId,
                    applyHospitalId: typeof _this.restaurants.applyHospitalId == 'number' ?  _this.restaurants.applyHospitalId : '',
                    applyHospitalType: _this.restaurants.hospitalType,
                    applyHospitalLevel: _this.restaurants.hospitalLevel,
                    applyOffice: _this.restaurants.applyOffice,
                    applyAddressSheng: _this.sheng1,
                    applyAddressShi: _this.shi1,
                    applyAddressQuxian: _this.qu1,
                    applyAddressDetail: _this.restaurants.addressDetail,
                    applyReason: _this.restaurants.applyReason,
                };

                console.log( this.dialogTitle, _this.restaurants,data )

                this.$http({
                    url: url,
                    method: "post",
                    headers: {"X-Requested-With": "XMLHttpRequest"},
                    data: data
                }).then(function (res) {
                    if (res.data.statusCode == 200) {
                        _this.isDialog = false;
                        _this.isUpdate = false;
                        _this.dialogVisible = false;
                        _this.queryApplyByLoginer();

                    }
                }).catch(function (catchres) {
                    _this.$message.error("加载失败！请重新加载...");
                });
            },


            //查询经销商管理人员，根据当前登录用户所在的经销商：
            selectDealerManager() {
                let _this = this;
                _this.glyxx=true;
                this.$http({
                    url: "/api/adscm/dealer/dealer/selectDealerManager?tokenId=" + _this.tokenId,
                    method: "post",
                    headers: { "X-Requested-With": "XMLHttpRequest" }
                }).then(function(res) {

                    console.log( res.data )

                    if (res.data.statusCode == 200) {
                        _this.adminformationName = res.data.content.name;
                        _this.adminformationPhone=res.data.content.phone;
                    } else {
                        _this.$message.error(res.data.desc);
                    }
                }).catch(function(catchres) {
                    _this.$message.error("加载失败！请重新加载...");
                });
            },



            choseSheng: function (e, index) {
                for (let index2 in this.shengs) {
                    if (e === this.shengs[index2].value) {
                        this.shis = this.shengs[index2].children;
                        this["shi" + index] = this.shengs[index2].children[0].value;
                        this.qus = this.shengs[index2].children[0].children;
                        this["qu" + index] = this.shengs[
                            index2
                            ].children[0].children[0].value;
                        this.E = this.qus[0].value;
                    }
                }
            },
            choseCity: function (e, index) {
                for (let index3 in this.city) {
                    if (e === this.city[index3].value) {
                        this.qus = this.city[index3].children;
                        this["qu" + index] = this.city[index3].children[0].value;
                        this.E = this.qus[0].value;
                    }
                }
            },
            choseBlock: function (e, index) {
                this.E = e;
            },

            handleSizeChange: function (size) {
                this.pagesize = size;
            },
            handleCurrentChange: function (currentPage) {
                this.currentPage = currentPage;
            },

            formatApplyTime(c,r,value,index){
                return value ? this.timestampToTime(value) : "";
            },

            timestampToTime(timestamp) {
                if (timestamp) {
                    let date = new Date(timestamp);
                    let Y = date.getFullYear() + "-";
                    let M =
                        (date.getMonth() + 1 < 10
                            ? "0" + (date.getMonth() + 1)
                            : date.getMonth() + 1) + "-";
                    let D =
                        (date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " ";
                    let h =
                        (date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) +
                        ":";
                    let m =
                        (date.getMinutes() < 10
                            ? "0" + date.getMinutes()
                            : date.getMinutes()) + ":";
                    return timestamp ? Y + M + D + h + m + "00" : "";
                } else {
                    return "";
                }
            }
        }
    };
</script>

<style scope></style>
